import { defineConfig } from 'rollup'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
// import del from 'rollup-plugin-del'
import copy from 'rollup-plugin-copy'


export default defineConfig({
  input: ['src/js/popup.js'],
  output: [{
    dir: 'dist/js/',
    format: 'iife'
  }],
  plugins: [
    // del({ targets: 'dist' }),
    resolve(),
    commonjs(),
    json(),
    copy({
      targets: [
        { src: 'src/js/*', dest: 'dist/js' },
        { src: 'src/monaco-editor/*', dest: 'dist/monaco-editor' },
        { src: 'src/images/*', dest: 'dist/images' },
        { src: 'src/css/*', dest: 'dist/css' },
        { src: 'src/manifest.json', dest: 'dist' },
        { src: 'src/popup.html', dest: 'dist' },
        { src: 'src/favicon.ico', dest: 'dist' },
      ]
    })
  ]
})